<template>
  <div>
    <!-- order404 -->
    <order404 v-if="$store.state.logging == 0 ? true : false"></order404>
    <!-- card -->
    <div class="cardContainer" v-if="$store.state.logging == 1 ? true : false">
      <!-- 新订单 -->
      <van-card tag="Hot" v-if="$store.state.buyList.toString() !== [].toString()" :price="$store.getters.payBill" :desc="new Date() | formatDate" :title="$store.state.shopInfo.name" :thumb="$store.state.shopInfo.img">
        <div slot="tags">{{$store.state.buyList[0].text}}{{$store.state.buyList.length > 1 ? `等${$store.state.buyList.length}件商品` : ''}}</div>
        <div slot="footer">
          <!-- btn -->
          <van-button plain hairline type="primary" size="small" :to="`/shopInfo/${$store.state.shopInfo.id}`">再来一单</van-button>
        </div>
      </van-card>
      <!-- 已经买的 -->
      <van-card tag="Hot" price="25.00" desc="2019-05-09 15:40" title="蒸滋味中式快餐" :thumb="'./static/images/shopList2.jpg'" origin-price="10.00">
        <div slot="tags">香汁排骨煲仔饭等2件商品</div>
        <div slot="footer">
          <!-- btn -->
          <van-button plain hairline type="primary" size="small" to="/shopInfo/2">再来一单</van-button>
        </div>
      </van-card>
    </div>
    <tabbar></tabbar>
  </div>
</template>
<script>
import { formatDate } from '../../common/dateTools'
import tabbar from '../tabbar/tabbar'
import order404 from '../order/order404'
export default {
  components: {
    tabbar,
    order404
  },
  filters: {
    formatDate(time) {
      let date = new Date(time)
      return formatDate(date, 'yyyy-MM-dd hh:mm')
    }
  },
}
</script>

<style lang="less" scoped>

</style>
